"use strict";
Geo.Geolocation.App = function(app) {
    if (app == undefined) throw new Geo.Exception("application is undefined");
    this.app = app;
};
Geo.Geolocation.App.prototype.start = function() {
    if (navigator.geolocation == undefined) throw new Geo.Exception("geolocation is not supported.");
    
    navigator.geolocation.getCurrentPosition(this.success, this.error, { enableHighAccuracy: true });
    this.id = navigator.geolocation.watchPosition(this.success, this.error, { enableHighAccuracy: true });
};
Geo.Geolocation.App.prototype.stop = function() {
    if (this.id == undefined) {
        navigator.geolocation.clearWatch(this.id);
    }
};
Geo.Geolocation.App.prototype.success = function (position) {
    this.app.SignalR.invoke({method:'Position', data: position});
};
Geo.Geolocation.App.prototype.error = function() {
};